﻿Public Class frmQuickList
    Private m_cPeople As ChildInfo()
    Private m_bArrive As Boolean
    Property People()
        Get
            Return Me.m_cPeople
        End Get
        Set(ByVal value)
            Me.m_cPeople = value
        End Set
    End Property
    Property Arrived()
        Get
            Return Me.m_bArrive
        End Get
        Set(ByVal value)
            Me.m_bArrive = CBool(value)
        End Set
    End Property
    Private Sub frmQuickList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ImageList1.Images.Add(My.Resources.noimage)
        Me.Icon = Icon.FromHandle(My.Resources.building.GetHicon)
        Dim kid As ChildInfo

        For Each [genericperson] As ChildInfo In Me.People
            kid = genericperson
            If kid IsNot Nothing Then
                If Me.Arrived = kid.Arrived Then
                    ImageList1.Images.Add(genericperson.ID, genericperson.Photo)

                    Dim z As New ListViewItem
                    z.ImageIndex = genericperson.ID
                    z.ToolTipText = String.Format("{0} {1}", Arguments(kid.FirstName, kid.LastName))
                    z.Tag = kid
                    lstView.Items.Add(z)
                End If
            End If
        Next
    End Sub

    Private Sub lstView_ItemActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstView.ItemActivate
        Dim kid As ChildInfo
        Try
            kid = TryCast(lstView.SelectedItems(0).Tag, ChildInfo)

            If MsgBox(String.Format("{0} {1} has " & IIf(Not Me.Arrived, "been dropped off", "been picked up") & "?", Arguments(kid.FirstName, kid.LastName)), MsgBoxStyle.YesNo, IIf(Not Me.Arrived, "Arrival", "Departure")) = MsgBoxResult.Yes Then
                kid.Arrived = True
                Me.Dispose()
            End If
        Catch ex As Exception
            Exit Sub
        End Try
    End Sub
End Class